package com.beiming.kotlindemo

/**
 * Created by lingchen on 2020/4/30. 16:38
 * mail:lingchen52@foxmail.com
 */
//子类Student主构造函数Student(val sno: String, val grade: Int, name: String, age: Int)调用父类Person
//主构造函数Person(val name: String, val age: Int)
class Student(val sno: String, val grade: Int, name: String, age: Int) : Person(name, age), Study {

    //主构造函数的函数体
    init {
        println("sno is " + sno)
        println("grade is " + grade)
    }

    //次构造函数必须（间接）调用主构造函数
    constructor(name: String, age: Int) : this("", 0, name, age) {}

    constructor() : this("", 0) {}

    override fun readBook() {
        println(name + " is reading.")
    }

    override fun doHomeWork() {
        println(name + " is doing homework.")
    }


//    var sno = ""
//    var grade = 0

}